# Maintainer:  Sergej Pupykin <arch+pub@sergej.pp.ru>
# Maintainer:  Eli Schwartz <eschwartz@archlinux.org>
# Contributor: Jens Staal <staal1978@gmail.com>

pkgname=kernel-headers-musl
pkgver=6.0
_rdate=20221017
pkgrel=1
pkgdesc="Linux kernel headers sanitized for use with musl libc"
arch=('loong64' 'x86_64')
url="https://github.com/sabotage-linux/kernel-headers"
license=('LGPL')
makedepends=(rsync)
depends=('musl')
source=(https://github.com/yetist/linux/releases/download/v${_rdate}/linux-${pkgver}-${_rdate}.tar.xz)
sha256sums=('ac4822f7dad35e42b1d0b02190eb876d80f3beefe9576ae8b45aeb5c5bc79eb1')

_CARCH=$CARCH
[[ $CARCH = i?86 ]] && _CARCH=x86
[[ $CARCH = loong64 ]] && _CARCH=loongarch

build() {
  cd "$srcdir"/linux-${pkgver/_/-}
  make ARCH=${_CARCH} mrproper
}

package() {
  cd "$srcdir"/linux-${pkgver/_/-}
  make ARCH=${_CARCH} INSTALL_HDR_PATH="$pkgdir/usr/lib/musl" headers_install
}
